Graphics
========================================

Image Image.createEmpty(width, height)
Image Image.load( filename )

nil image:blit(x, y, Image source, [sourcex, sourcey, width, height], [alpha = true])

nil image:clear([color = transparent-black]) 
nil image:fillRect(x, y, width, height, [color = transparent-black]) 
nil image:drawLine(x0, y0, x1, y1, [color = black]) 
Color image:pixel(x, y) --get
nil image:pixel(x, y, Color) --set

nil image:print(x, y, text, [color = black]) 

Number image:width()
Number image:height()
nil Image:save( filename )

global Image screen
nil screen.flip() -- note the small s; this is a function of the screen
nil screen.waitVblankStart([count])


Color Color.new(r, g, b, [a=255])
table[r,g,b,a] color:colors()
Bool (Color a == Color b)


Controls
========================================

Controls Controls.read()
Bool controls:select()
Bool controls:start()
Bool controls:up()
Bool controls:right()
Bool controls:down()
Bool controls:left()
Bool controls:l()
Bool controls:r()
Bool controls:triangle()
Bool controls:circle()
Bool controls:cross()
Bool controls:square()
Bool controls:home()
Bool controls:hold()
Bool controls:note()
Number controls:analogX() -- ranges from -127 to 128.
Number controls:analogY() -- same

Bool (Controls a == Controls b) -- note! The analog stick is NOT considered when comparing because of analog fluctuations.

System
========================================
String System.currentDirectory() -- get
String System.currentDirectory( path ) -- set, returns old path.
table System.listDirectory()
table System.listDirectory( path )

nil System.usbDiskModeActivate()

Activates the USB mode. Attention: When writing from USB to the memory stick, you must not
write from within your Lua script to the memory stick, until you disable USB, otherwise
the filesystem of your memory stick gets corrupted and you have to reformat your
memmory stick.

nil System.usbDiskModeDeactivate()

Deactivates the USB mode.

Sound and music
========================================
nil Music.playFile( string file, bool loop )
nil Music.pause()
nil Music.resume()
nil Music.stop()
bool Music.playing()
Number Music.volume( [number {0-128}] )

nil SoundSystem.SFXVolume( number {0-128} )
nil SoundSystem.reverb( number {0-15} )
nil SoundSystem.panoramicSeparation( number {0-128} )

Sound Sound.load(filename, [bool loop])
Voice sound:play()

nil voice:stop()
nil voice:resume(Sound) -- DISABLED due to bug.
nil voice:volume( number [0-25] )
nil voice:pan( number [0-255] )
nil voice:frequency( number [0-255] )
bool voice:playing()


Notes
============
 - It's possible to tell mikmod to loop only a part of a sample, or loop backwards, or loop back and forth. Tell nevyn if these attributes are needed.

 - It's a good idea to ignore low values (perhaps -5<x, y<+5) for the analog stick, as its dead zone is larger than a single integer step.